<?php
/**
 * Vypisovaci modul logovej spravy
 * @author Tomas Srna
 * @package bakalarka
 */

class LogMessageWriter implements Writer
{
	public $raw = "";
	public $truncate = 100;
	
	public function set($raw)
	{
		$this->raw = $raw;
		return $this;
	}
	
	public function write()
	{
		$string = L::translate($this->raw);
		$write = $string;
		if(strlen($string) > $this->truncate)
		{
			echo "<a href=\"javascript:alert('".
				str_replace("'", "\\'", F::he($string))."');\">".
				substr($string, 0, $this->truncate-3)."..."."</a>";
		}
		else
			echo F::he($write);
	}
}
